//线程启动文件
#include "startup_thread.h"
#include "stdint.h"
#include "main.h"
#include "startup_thread.h"
#include "nf_thread.h"
#include "ws2812_thread.h"
#include "Switch.h"

static rt_thread_t LED_thread = RT_NULL;
static rt_thread_t nf_thread = RT_NULL;

static rt_thread_t ws2811_thread = RT_NULL;

static rt_thread_t sw_thread = RT_NULL;

void LED_thread_entry(void *p_arg)
{
	while(1)
  {
		HAL_GPIO_WritePin(LED1_GPIO_Port,LED1_Pin,GPIO_PIN_RESET);
		HAL_GPIO_WritePin(LED2_GPIO_Port,LED2_Pin,GPIO_PIN_SET);
    rt_thread_mdelay(100);
		HAL_GPIO_WritePin(LED1_GPIO_Port,LED1_Pin,GPIO_PIN_SET);
		rt_thread_mdelay(100);
  }
}
void startup_thread()
{
	//Init_Model();
	LED_thread = rt_thread_create("LED",						//线程名字									
	                LED_thread_entry,				//线程入口函数
									RT_NULL,						//线程入口函数参数
									LED_thread_stack_size,		//线程栈大小
									LED_thread_priority,			//线程优先级
									LED_thread_tick);				//线程时间片
	if(LED_thread != RT_NULL) rt_thread_startup(LED_thread);
	
	nf_thread = rt_thread_create("nf",						//线程名字									
	                nf_thread_entry,				//线程入口函数
									RT_NULL,						//线程入口函数参数
									nf_thread_stack_size,		//线程栈大小
									nf_thread_priority,			//线程优先级
									nf_thread_tick);				//线程时间片
	if(nf_thread != RT_NULL) rt_thread_startup(nf_thread);
	
	ws2811_thread = rt_thread_create("2811",						//线程名字									
	                WS2812_thread_entry,				//线程入口函数
									RT_NULL,						//线程入口函数参数
									ws2811_thread_stack_size,		//线程栈大小
									ws2811_thread_priority,			//线程优先级
									ws2811_thread_tick);				//线程时间片
	if(ws2811_thread != RT_NULL) rt_thread_startup(ws2811_thread);
	
	sw_thread = rt_thread_create("sw",						//线程名字									
	                SW_thread_entry,				//线程入口函数
									RT_NULL,						//线程入口函数参数
									SW_thread_stack_size,		//线程栈大小
									SW_thread_priority,			//线程优先级
									SW_thread_tick);				//线程时间片
	if(sw_thread != RT_NULL) rt_thread_startup(sw_thread);
}
